### 
 # @Description: zookeeper
 # @version: 1.0.0
 # @Company: sdbean
 # @Author: Symars
 # @Date: 2020-04-13 01:08:24
 # @LastEditors: Symars
 # @LastEditTime: 2020-04-13 01:08:24
 ###

#zookeeper_node_1
# cd /data/lib/zookeeper/data
# touch myid
# echo 1 > myid
# chmod 755 myid
docker run -d --network kafka_online \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
-v /data/lib/zookeeper/data:/data \
-v /data/lib/zookeeper/datalog:/datalog \
-v /data/log/zookeeper:/logs \
--name zookeeper_node_1 \
--restart always \
-e ZOO_MY_ID=1 \
-e ZOO_SERVERS="server.1=0.0.0.0:2888:3888;2181 server.2=172.16.50.223:2888:3888;2181 server.3=172.16.50.225:2888:3888;2181" \
zookeeper

#zookeeper_node_2
# cd /data/lib/zookeeper/data
# touch myid
# echo 2 > myid
# chmod 755 myid
docker run -d --network kafka_online \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
-v /data/lib/zookeeper/data:/data \
-v /data/lib/zookeeper/datalog:/datalog \
-v /data/log/zookeeper:/logs \
--name zookeeper_node_2 \
--restart always \
-e ZOO_MY_ID=2 \
-e ZOO_SERVERS="server.1=172.16.50.224:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181 server.3=172.16.50.225:2888:3888;2181" \
zookeeper

#zookeeper_node_3 
# cd /data/lib/zookeeper/data
# touch myid
# echo 3 > myid
# chmod 755 myid
docker run -d --network kafka_online \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
-v /data/lib/zookeeper/data:/data \
-v /data/lib/zookeeper/datalog:/datalog \
-v /data/log/zookeeper:/logs \
--name zookeeper_node_3 \
--restart always \
-e ZOO_MY_ID=3 \
-e ZOO_SERVERS="server.1=172.16.50.224:2888:3888;2181 server.2=172.16.50.223:2888:3888;2181 server.3=0.0.0.0:2888:3888;2181" \
zookeeper 

docker exec -it zookeeper_node_1 bash
zkServer.sh status


#conf 如果conf不匹配需要linux本地配置，并映射到docker镜像中
-v /data/conf/zoo.cfg:/conf/zoo.cfg \

###zoo.cfg###
clientPort=2181
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
autopurge.snapRetainCount=3
autopurge.purgeInterval=0
maxClientCnxns=60
server.1=172.16.50.223:2888:3888
server.2=172.16.50.224:2888:3888
server.3=172.16.50.225:2888:3888
###zoo.cfg###